<?php
class WebUser extends CWebUser
{
	const SECURED_IS_AUTH = 'isAuth';

	public function isAdmin()
	{
		return (
			(! empty(Yii::app()->user->model)) &&
			(User::ROLE_ADMIN == Yii::app()->user->model->role)
		);
	}

	protected function afterLogin($fromCookie)
	{
		Yii::app()->securedSession->set(self::SECURED_IS_AUTH, true);
	}
	
	protected function afterLogout() 
	{
	    Yii::app()->securedSession->remove(self::SECURED_IS_AUTH);
	}
}
